<?php

include _ITSTOCK_INCLUDE_DIR_.'html_message.inc.php';
include _ITSTOCK_INCLUDE_DIR_.'settings_html.inc.php';
include _ITSTOCK_INCLUDE_DIR_.'html_menu.inc.php';

$itstock_page_info['css'] = array('main.css', 'summary.css', 'aside.css', 'page.css', 'table.css', 'lightbox.css', 'float_menu.css', 'form_save.css');
$itstock_page_info['js'] = array('common.js', 'menu.js', 'ajax.js', 'request.js', 'lightbox.js', 'settings.js', 'search.js');

itstock_structure($structure, 'setting');
$structure['where'][0] = 'username=\''.$_SESSION['user']['ads_u'].'\'';

$_SESSION['on_delete']['setting'] = $_SERVER['REQUEST_URI'];
$_SESSION['on_save']['setting'] = $_SERVER['REQUEST_URI'];

itstock_html_base_header($itstock_page_info);
?>
  <div class="aside">
  <?php
    itstock_settings_menu();
  ?>
  </div>
  <div class="bside">
    <h3>User Preferences</h3>
    <br>
    <br>
    <?php itstock_html_message(); ?>
    <!-- table class="form_save">
      <tr>
        <td><label>Default Location: </label></td>
        <td>
          < ?php
            $structure['where'][1] = 'setting=\'default_location\'';
            $edit = itstock_search_all($structure);
          ?>
          <form action="store.php?type=setting" method="POST" id="form_settings" autocomplete="off">
          <input type="hidden" value="< ?php echo ($edit?itstock_encode($structure['data'][0]['id']):'')?>" id="id" name="id">
          <input type="hidden" value="default_location" name="setting">
          <input type="hidden" value="< ?php echo $_SESSION['user']['ads_u'];?>" name="username">
          <input type="hidden" value="< ?php echo ($edit?$structure['data'][0]['svalue']:'');?>" id="location_id" name="svalue">
          <label onclick="itstock_locations();" id="set_location">< ?php
            if($edit){
            itstock_structure($location, 'location');
            $location['where'][0] = 'locations.`id`='.itstock_decode($structure['data'][0]['svalue']);
            if(itstock_search_all($location)){
              echo $location['data'][0]['building'] . ' ' .
                   $location['data'][0]['department'] . ' ' .
                   $location['data'][0]['floor'] . ' ' .
                   $location['data'][0]['spot'] . ' ' .
                   $location['data'][0]['location'];
            } else {
              echo 'Not Found';
            }
            } else {
              echo 'Not Set';
            }
          ?></label>
          &nbsp;
          <input type="submit" value="Save">
          </form>
        </td>
      </tr>
    </table>
  </div>
<?php
  itstock_html_base_footer(); 
?>